/*
 * Copyright (c) 2017, www.zm0618.com All Rights Reserved..
 */

package com.light.hessian.provider.discovery;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by zhaojun on 2017/02/16.
 */
public abstract class ProviderDiscovererSupport extends AbstractProviderDiscoverer{

    protected static ThreadPoolExecutor poolExecutor;

    {
        initAutoDiscoveryThreadPool();
    }
    public void initAutoDiscoveryThreadPool() {
        if (poolExecutor==null){
            synchronized (ProviderDiscovererSupport.class){
                if (poolExecutor==null){
                    poolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(2);
                    logger.debug("#######init DiscoveryThreadPool!#########");
                }
            }
        }
    }

    public ThreadPoolExecutor getPoolExecutor() {
        return poolExecutor;
    }
}
